<template>
    <div class="person">
        <h2>姓名：{{ name }}</h2>
        <h2>年龄：{{ age }}</h2>
        <button @click="showTel">查看联系方式</button>
    </div>
    </template>
    
    <script lang="ts">
    //js 或ts
    export default {
        name:'Person', //组件名
        data() {
            return{
                name:"张三",
                age:18,
                tel:'13888888888'
            }
        },
        methods:{
            showTel(){
                alert(this.tel)
            }
        }
    }
    </script>
  